package edu.ptu.acl.dto.param;

import lombok.Data;

import javax.validation.constraints.*;

@Data
public class AclParam {

    @Min(value = 10000000000000000L,message = "id不规范" ,groups = Update.class)
    private Long id;

    /**
     * 类型：0:接口1:按钮2:路由
     */
    @Pattern(regexp = "[012]",message = "类型异常",groups = {Update.class, Save.class})
    @NotBlank(message = "类型不能为空",groups = {Update.class, Save.class})
    private String type;

    @NotBlank(message = "状态不能为空",groups = {Update.class, Save.class})
    @Pattern(regexp = "[10]",message = "状态异常",groups = {Update.class, Save.class})
    private String status;

    @NotNull(message = "顺序不能为空",groups = {Update.class,Save.class})
    @Max(value = 123,message = "seq最大123",groups = {Update.class, Save.class})
    private Integer seq;

    @NotNull(message = "父模块id不能为空",groups = {Update.class,Save.class})
    private Long parentId;

    @NotBlank(message = "名称不能为空",groups = {Update.class,Save.class})
    private String name;

    /**
     * 接口路径(含正则)/前端路径
     */
    private String url;

    /**
     * 按钮授权标识(唯一)
     */
    private String buttonId;

    /**
     * 前端组件
     */
    private String component;

    /**
     * 备注
     */
    private String remark;

    /**
     * 乐观锁
     */
    @NotNull(message = "乐观锁版本不能为空",groups = {Update.class})
    private Integer version;

    /*
     * 保存的时候校验分组
     */
    public interface Save {
    }

    /**
     * 更新的时候校验分组
     */
    public interface Update {
    }
}
